﻿//---------------------------------------------------------------------------------
// Copyright 2011 Microsoft Corporation
// Licensed under the Microsoft Public License (MS-PL) (the "License"); 
// You may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.opensource.org/licenses/ms-pl.html
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR 
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
// INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
// MERCHANTABLITY OR NON-INFRINGEMENT. 
// See the Microsoft Public License (MS-PL) for the specific language governing 
// permissions and limitations under the License.
//---------------------------------------------------------------------------------
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Microsoft.Telco.Controls
{
    /// <summary>
    /// Custom button created using just border and textblock.
    /// Normal SL 4 buttons not working on current version of WP7
    /// </summary>
    public partial class TelcoButton : UserControl
    {
        /// <summary>
        /// Occurs when the border is clicked.
        /// </summary>
        public event RoutedEventHandler Click;

        /// <summary>
        /// Sets the caption for button.
        /// </summary>
        /// <value>The caption.</value>
        public string Caption
        {
            set { tbContent.Text = value; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TelcoButton"/> class.
        /// </summary>
        public TelcoButton()
        {
            InitializeComponent();
        }

        #region event handlers
        private void border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (this.Click != null)
            {
                this.Click(sender, e);
            }
        }
        #endregion
    }
}
